home *** CD-ROM | disk | FTP | other *** search
- Path: galaxy.ucr.edu!not-for-mail
- From: thp@cs.ucr.edu (Tom Payne)
- Newsgroups: comp.lang.ada,comp.lang.c++
- Subject: Re: on OO differnces between Ada95 and C++
- Followup-To: comp.lang.ada,comp.lang.c++
- Date: 2 Mar 1996 01:23:07 GMT
- Organization: University of California, Riverside
- Message-ID: <4h87tr$eet@galaxy.ucr.edu>
- References: <4gbq7q$g08@qualcomm.com> <3129F185.41C6@Rational.COM> <4gi413$qo1@druid.borland.com> <312D8EF7.167E@Rational.COM> <4h08j9$f7v@nntpa.cb.att.com>
- NNTP-Posting-Host: corvette.ucr.edu
- X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
-
- Kenneth Almquist (ka@socrates.hr.att.com) wrote:
- : Jerome Desquilbet <jDesquilbet@Rational.COM> asks:
- : > Pete,
- : > What is this "one definition rule"? Could you point me to the
- : > appropriate C++ Draft Standard location?
- :
- : I'm not Pete, but I happen to know the answer. See section 3.2 in the
- : April draft. The relevant paragraph reads:
- :
- : 7 There can be more than one definition of a class type in a program
- : provided that each definition appears in a different translation unit
- : and the definitions describe the same type.
-
- So, what exactly does "one definition" mean here? Is it forms or
- occurrences that are being counted? Or, does the answer vary
- depending on whether the definition is of a function or a type? And,
- on whether the multiple occurrences are in the same or different
- files?
-
- Under the classical independent-compilation model (e.g., g++), I would
- expect multiple occurrences of identical definitions to produce errors
- if and only if they allocate space (objects and non-inline functions)
- or occur in the same translation unit. It would seem that in, say,
- the case of the definition of an inline function, we need an
- (identical) occurrence in each translation unit that calls that
- function.
-
-
- Tom Payne (thp@cs.ucr.edu)
-